package android.zhcs.myapplication;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.View;
import android.zhcs.myapplication.databinding.ActivityDlMain2Binding;

import androidx.appcompat.app.AppCompatActivity;

public class dlMainActivity2 extends AppCompatActivity {
    public static String sj;
    public static String rq;
    public static String lx;

    public static void start(Context c) {
        Intent intent = new Intent(c, dlMainActivity2.class);
        c.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getSupportActionBar().hide();
        if(!PreferenceManager.getDefaultSharedPreferences(dlMainActivity2.this).getString("data", "").equals("")){
            finish();
            MainActivity2zfcg.start(dlMainActivity2.this);
        }
        ActivityDlMain2Binding b =ActivityDlMain2Binding.inflate(getLayoutInflater());
        setContentView(b.getRoot());
        b.fh.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        b.qr.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
//                if (b.xz1.getSelectedItemPosition() == 0 && b.xz2.getSelectedItemPosition() == 0 && b.xz3.getSelectedItemPosition() == 0){
//                    Toast.makeText(dlMainActivity2.this,"请选择必须的选项！",Toast.LENGTH_SHORT).show();
//                }else{
                    lx = b.xz1.getSelectedItem().toString();
                    rq = b.xz2.getSelectedItem().toString();
                    sj = b.xz3.getSelectedItem().toString();
                PreferenceManager.getDefaultSharedPreferences(dlMainActivity2.this).edit().putString("rq",rq).apply();
                PreferenceManager.getDefaultSharedPreferences(dlMainActivity2.this).edit().putString("sj",sj).apply();
                PreferenceManager.getDefaultSharedPreferences(dlMainActivity2.this).edit().putString("lx",lx).apply();
                    MainActivity2sy.start(dlMainActivity2.this);
//                }
            }
        });
    }
}